Fix CPU hotplug -- cpu initialisation functions must be declared
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 1 Nov 2005 15:28:20 +0000 (16:28 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 1 Nov 2005 15:28:20 +0000 (16:28 +0100)
__cpuinit or later hotplug references freed code and data.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c
patches/linux-2.6.12/cpu-hotplug-init.patch [new file with mode: 0644]

index 861c2d2f62997b53913b043703b25ae6237d77e7..8a718ea36bd7a06df4da534d55fcbf765588e832 100644 (file)
@@ -520,7 +520,7 @@ void __init print_cpu_info(struct cpuinfo_x86 *c)
                printk("\n");
 }
 
-cpumask_t cpu_initialized __initdata = CPU_MASK_NONE;
+cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
 /* This is hacky. :)
  * We're emulating future behavior.
@@ -562,7 +562,7 @@ void __init early_cpu_init(void)
 #endif
 }
 
-void __init cpu_gdt_init(struct Xgt_desc_struct *gdt_descr)
+void __cpuinit cpu_gdt_init(struct Xgt_desc_struct *gdt_descr)
 {
        unsigned long frames[16];
        unsigned long va;
@@ -585,7 +585,7 @@ void __init cpu_gdt_init(struct Xgt_desc_struct *gdt_descr)
  * and IDT. We reload them nevertheless, this function acts as a
  * 'CPU state barrier', nothing should get across.
  */
-void __init cpu_init (void)
+void __cpuinit cpu_init (void)
 {
        int cpu = smp_processor_id();
        struct tss_struct * t = &per_cpu(init_tss, cpu);
index fc8eff4402f8deef9f9194133ac8ed3cafd659db..56c546fec52e4eb148e6d08a0e41c9ba417c735b 100644 (file)
@@ -35,7 +35,7 @@
 #endif
 char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
 
-cpumask_t cpu_initialized __initdata = CPU_MASK_NONE;
+cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
 struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 
 
@@ -130,7 +130,7 @@ static void switch_pt(void)
         xen_new_user_pt(__pa(init_level4_user_pgt));
 }
 
-void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
+void __cpuinit cpu_gdt_init(struct desc_ptr *gdt_descr)
 {
        unsigned long frames[16];
        unsigned long va;
@@ -227,7 +227,7 @@ void syscall_init(void)
 #endif
 }
 
-void __init check_efer(void)
+void __cpuinit check_efer(void)
 {
        unsigned long efer;
 
@@ -244,7 +244,7 @@ void __init check_efer(void)
  * 'CPU state barrier', nothing should get across.
  * A lot of state is already set up in PDA init.
  */
-void __init cpu_init (void)
+void __cpuinit cpu_init (void)
 {
 #ifdef CONFIG_SMP
        int cpu = stack_smp_processor_id();
diff --git a/patches/linux-2.6.12/cpu-hotplug-init.patch b/patches/linux-2.6.12/cpu-hotplug-init.patch
new file mode 100644 (file)
index 0000000..9e039db
--- /dev/null
@@ -0,0 +1,34 @@
+diff -ur linux-2.6.12.orig/include/linux/init.h linux-2.6.12/include/linux/init.h
+--- linux-2.6.12.orig/include/linux/init.h     2005-11-01 14:52:28.656025573 +0000
++++ linux-2.6.12/include/linux/init.h  2005-11-01 14:53:28.015791549 +0000
+@@ -229,6 +229,18 @@
+ #define __devexitdata __exitdata
+ #endif
++#ifdef CONFIG_HOTPLUG_CPU
++#define __cpuinit
++#define __cpuinitdata
++#define __cpuexit
++#define __cpuexitdata
++#else
++#define __cpuinit     __init
++#define __cpuinitdata __initdata
++#define __cpuexit __exit
++#define __cpuexitdata __exitdata
++#endif
++
+ /* Functions marked as __devexit may be discarded at kernel link time, depending
+    on config options.  Newer versions of binutils detect references from
+    retained sections to discarded sections and flag an error.  Pointers to
+diff -ur linux-2.6.12.orig/arch/x86_64/kernel/i387.c linux-2.6.12/arch/x86_64/kernel/i387.c
+--- linux-2.6.12.orig/arch/x86_64/kernel/i387.c        2005-11-01 15:01:58.932991232 +0000
++++ linux-2.6.12/arch/x86_64/kernel/i387.c     2005-11-01 15:02:09.729312416 +0000
+@@ -42,7 +42,7 @@
+  * Called at bootup to set up the initial FPU state that is later cloned
+  * into all processes.
+  */
+-void __init fpu_init(void)
++void __cpuinit fpu_init(void)
+ {
+       unsigned long oldcr0 = read_cr0();
+       extern void __bad_fxsave_alignment(void);